wayland: Don't try to guess the popup menu placement when it was set
authorJonas Ådahl <jadahl@gmail.com>
Fri, 5 Jun 2015 05:35:21 +0000 (13:35 +0800)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 10 Jun 2015 03:28:32 +0000 (11:28 +0800)
If a position was already explicitly set, don't try to guess the
position of popup menus by looking at the pointer position, just use
the set coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=748951

gdk/wayland/gdkwindow-wayland.c

index 19d92244dd55fc5788dab46972dd517477e5a6b7..590ff4d8c1735444ccfb01c08de68796b1fd6979 100644 (file)
@@ -108,6 +108,7 @@ struct _GdkWindowImplWayland
   unsigned int use_custom_surface : 1;
   unsigned int pending_commit : 1;
   unsigned int awaiting_frame : 1;
+  unsigned int position_set : 1;
   GdkWindowTypeHint hint;
   GdkWindow *transient_for;
 
@@ -1190,10 +1191,13 @@ gdk_wayland_window_map (GdkWindow *window)
           transient_for = gdk_device_get_window_at_position (impl->grab_device, NULL, NULL);
           transient_for = gdk_window_get_toplevel (transient_for);
 
-          /* start the popup at the position of the device that holds the grab */
-          gdk_window_get_device_position (transient_for,
-                                          impl->grab_device,
-                                          &window->x, &window->y, NULL);
+          /* If the position was not explicitly set, start the popup at the
+           * position of the device that holds the grab.
+           */
+          if (!impl->position_set)
+            gdk_window_get_device_position (transient_for,
+                                            impl->grab_device,
+                                            &window->x, &window->y, NULL);
         }
       else
         transient_for = impl->transient_for;
@@ -1412,6 +1416,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
         {
           window->x = x;
           window->y = y;
+          impl->position_set = 1;
 
           if (impl->subsurface)
             {